import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('DisableComponent')
export class DisableComponent extends Component {

    @property(Number)
    public time: number = 2;

    start() {
        this.time = 2;
    }

    onEnable() {
        let myThis = this;
        this.scheduleOnce(function () {
            myThis.node.active = false;
        }.bind(this), this.time);
    }

}

